1. Field of the Invention
The present invention relates to microprocessor systems, and more particularly, to a concurrent cache line replacement method and apparatus for a high performance microprocessor system with a write-back cache memory.
2. Related Applications
This application is related to copending U.S. patent application Ser. No. 07/976,891, filed Nov. 16, 1992, entitled, "Zero Wait State Level 2 Cache Memory Using Non-Interleaved Banks of Asynchronous SRAMs," copending U.S. patent application Ser. No. 07/977,228, filed Nov. 16, 1992, entitled, "Pseudo-Concurrent Access to a Cached Shared Resource," and copending U.S. patent application Ser. No. 07/977,232, filed Nov. 16, 1992, entitled, "Dynamic Cache Coherency Method and Apparatus."
3. Art Background
In order to avoid frequent, cycle consuming accesses of main memory, a microprocessor system frequently utilizes cache memory. A cache memory is typically comprised of a relatively small amount of static random access memory (SRAM) which is both physically faster than main memory and arranged such that it can be addressed more rapidly than main memory. The cache memory is then disposed between the microprocessor and the main memory and used to capture and store instructions and data as they are used by the microprocessor. Once these instructions and data are present in the cache memory, the microprocessor can, thereafter, quickly and advantageously access them in the cache memory rather than in main memory. The intelligent design and management of a cache memory can substantially enhance the performance of the overall microprocessor system.
One of the problems associated with the use of a cache memory in a micoprocessor system, however, is the problem of cache coherency. In particular, when a block of data is first placed in the cache memory from main memory the block of data constitutes an exact copy of the block of data as stored in main memory. If the microprocessor, however, later modifies this block of data in cache memory, for example, through a write operation, and fails to similarly modify the corresponding block of data in main memory, the two blocks of data become inconsistent or incoherent. Under such circumstances, the main memory will continue to store what is now a "stale" block of data, while the cache memory stores the proper "updated" block of data. If an I/O unit or an additional, associated microprocessor thereafter accesses the block of data in main memory, it improperly accesses a stale block of data. For this reason, as well as others appreciated by those skilled in the art, cache coherency must be maintained in a microprocessor system.
Two basic solutions to the problem of cache coherency have been devised. The first solution utilizes what is termed "a write through cache." In a write through cache, coherency is maintained by insuring that whenever a write operation to a block of data in cache memory occurs, a similar write operation is also performed on the corresponding block of data residing in main memory. While this approach effectively guarantees coherency, it also exacts a heavy performance price, as the length of each and every write operation is determined not by the relatively fast time it takes to write to cache memory, but instead, by the relatively slow amount of time it takes to write to main memory.
A second solution which offers higher performance by not exacting as much processor overhead utilizes what is termed "a write back cache." In a write back cache, a write operation to a block of data in cache memory is not immediately accompanied with a similar write operation to the corresponding block of data residing in main memory. Instead, cache coherency is maintained through the use of subsequent and selective write back operations from the cache memory to the main memory. Such write back operations can be made selectively whenever they are required to maintain cache coherency.
One common context in which a write back cache necessarily utilizes a write back occurs in a write back cache when a processor read access results in a cache miss to a modified or "dirty" cache line such that in order to avoid an overwriting of the older, dirty cache line, a write back of the dirty cache line to main memory must occur. In such a scenario, in prior art systems, two separate operations were performed in serial fashion. First, the older, dirty cache line was written to main memory. Second, and serially, the new cache line was written from main memory to the former location of the older, dirty cache line. Such prior art replacement approaches, however, adversely required the processor to wait or stall for the whole duration of the serial replacement operation, resulting in the waste of valuable processor time. As will be described, the present invention provides for a concurrent cache line replacement method and apparatus which advantageously minimizes processor overhead.